using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.Needs;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
using BusinessObjects;
using BussinessObjects.BO_Actions.Needs;
namespace BusinessObjects.BO_GetObjects
{
    public static class BO_Needs
    {
        public static DataTable SelectAll(int status)
        {
            try
            {
                BONeeds_Select_All action = new BONeeds_Select_All();
                usp_Needs_Select_All entity = new usp_Needs_Select_All();
                entity.STATUS = status;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string UpdateOrder(int need_id, int sort_display, DateTime modify_date, string modify_by)
        {
            try
            {
                BONeeds_Update_Order action = new BONeeds_Update_Order();
                usp_Needs_Update_Order entity = new usp_Needs_Update_Order();
                entity.NEED_ID = need_id;
                entity.SORT_DISPLAY = sort_display;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;

                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Order(string needs)
        {
            try
            {
                BONeeds_Order action = new BONeeds_Order();
                usp_Needs_Order entity = new usp_Needs_Order();
                entity.NEEDS = needs;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectTop(int rows, int status)
        {
            try
            {
                BONeeds_Select_Top action = new BONeeds_Select_Top();
                usp_Needs_Select_Top entity = new usp_Needs_Select_Top();
                entity.NUMBERRECORD = rows;
                entity.STATUS = status;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable Search(int need_id)
        {
            try
            {
                BONeeds_Search action = new BONeeds_Search();
                usp_Needs_Search entity = new usp_Needs_Search();
                entity.NEED_ID = need_id;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectWithPaged(int startIndex, int pageCount, int status)
        {
            try
            {
                BONeeds_Select_WithPaged action = new BONeeds_Select_WithPaged();
                usp_Needs_Select_WithPaged entity = new usp_Needs_Select_WithPaged();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectCategory(int category, int startIndex, int pageCount, int status)
        {
            try
            {
                BONeeds_Select_Category action = new BONeeds_Select_Category();
                usp_Needs_Select_Category entity = new usp_Needs_Select_Category();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                entity.CATEGORY = category;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectCategoryDisplay(int category)
        {
            try
            {
                BONeeds_Select_Category_Display action = new BONeeds_Select_Category_Display();
                usp_Needs_Select_Category_Display entity = new usp_Needs_Select_Category_Display();
                entity.CATEGORY = category;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Insert(int category_id, string need_name, int sort_display, DateTime created_date, string created_by, DateTime modify_date, string modify_by, bool status)
        {
            try
            {
                BONeeds_Insert action = new BONeeds_Insert();
                usp_Needs_Insert entity = new usp_Needs_Insert();
                entity.CATEGORY_ID = category_id;
                entity.NEED_NAME = need_name;
                entity.SORT_DISPLAY = sort_display;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;

                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Update(int need_id, int category_id, string need_name, int sort_display, DateTime created_date, string created_by, DateTime modify_date, string modify_by, bool status)
        {
            try
            {
                BONeeds_Update action = new BONeeds_Update();
                usp_Needs_Update entity = new usp_Needs_Update();
                entity.NEED_ID = need_id;
                entity.CATEGORY_ID = category_id;
                entity.NEED_NAME = need_name;
                entity.SORT_DISPLAY = sort_display;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;

                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Delete(int need_id)
        {
            try
            {
                BONeeds_Delete action = new BONeeds_Delete();
                usp_Needs_Delete entity = new usp_Needs_Delete();
                entity.NEED_ID = need_id;

                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Restore(int need_id)
        {
            try
            {
                BONeeds_Restore action = new BONeeds_Restore();
                usp_Needs_Restore entity = new usp_Needs_Restore();
                entity.NEED_ID = need_id;

                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}

